package com.itheima.mapper;

import com.itheima.po.*;
import com.itheima.utils.MybatisUtils;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.Test;

import java.io.InputStream;
import java.util.List;

public class MybatisTest {
    @Test
  public void findAllUserTest(){
      SqlSession sqlSession=MybatisUtils.getSession();
      List<User> list=sqlSession.selectList("com.itheima.mapper.UserMapper.findAllUser");
      for (User user:list){
          System.out.println(user);
      }
      sqlSession.close();
  }
  @Test
    public void findUserByIdTest(){
        SqlSession sqlSession=MybatisUtils.getSession();
        User user=sqlSession.selectOne("com.itheima.mapper.UserMapper.findUserById");
            System.out.println(user);
        sqlSession.close();
    }
}
